#/bin/bash

if (($#==0)); then
	echo "error: no arg[1]"
	echo "Usage: sh $0 <96.133>"
    exit 1
fi

setIP=192.168.$1
OP="-o StrictHostKeyChecking=no"
SSHCMD="sshpass -p p@ssword ssh ${OP} root@${setIP} "

cat > /tmp/set_history <<EOF
if [[ \$- == *i* ]]
then
    bind '"\\e[A": history-search-backward'
    bind '"\\e[B": history-search-forward'
fi

EOF
sshpass -p p@ssword scp /tmp/set_history root@${setIP}:/tmp/
sleep 2
${SSHCMD} 'cat /tmp/set_history >> /etc/bashrc'
${SSHCMD} 'source /etc/bashrc'
#sshpass -p p@ssword ssh -o StrictHostKeyChecking=no root@192.168.96.237 "cat /tmp/set_history > /tmp/3"
